package com.example.admin.controller;

import com.example.admin.service.MemberService;
import com.example.member.api.MemberClient;
import com.example.member.api.model.MemberReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/admin/member")
public class MemberAdminController {

    @Autowired
    private MemberClient memberClient;

    @Autowired
    private MemberService memberService;

    @GetMapping("/list")
    public List<Map<String, Object>> memberList() {
        return memberService.memberList();
    }


    @GetMapping("/add")
    public void addMember() {
        log.info("svc-admin ~~~~~~");
        MemberReq memberReq = new MemberReq();
        memberReq.setName("张三");
        memberClient.addMember(memberReq);
    }
}
